package com.example.spareparts.service;

import com.example.spareparts.entity.User;
import com.example.spareparts.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {
    @Autowired
    private UserRepository userRepository;

    public List<User> findAllUser()
    {
        return userRepository.findAllUser();
    }

    public void insertUser(User user)
    {
        userRepository.insertUser(user);
    }
    public void updateUser(User user)
    {
        userRepository.updateUser(user);
    }
    public void deleteUser(Long userid)
    {
        userRepository.deleteUser(userid);
    }
    public User findUserById(Long userid)
    {
        return userRepository.findUserById(userid);
    }
    public User findUserByUsername(String username)
    {
        return userRepository.findUserByUsername(username);
    }
}
